#include <bits/stdc++.h>

using namespace std;

int n,a,b,bt[210];
struct node{
    int p,s;
}node1;
bool hasvis[210];
int main()
{
    cin>>n>>a>>b;
    for(int i =1 ;i<=n ;i++){
        scanf("%d",&bt[i]);
    }
    queue <node> q;
    node1.p = a;node1.s = 0;
    q.push(node1);
    hasvis[node1.p] = 1;
    while(!q.empty()){
        node t = q.front();
        if(t.p == b){
            cout<<t.s;
            return 0;
        }
        int dp =t.p+bt[t.p];
        if(dp>=1&&dp<=n&&!hasvis[dp]){
            q.push((node){dp,t.s+1});
            hasvis[dp] = 1;
        }
        dp = t.p-bt[t.p];
        if(dp>=1&&dp<=n&&!hasvis[dp]){
            q.push((node){dp,t.s+1});
            hasvis[dp] = 1;
        }
        q.pop();
    }
    cout<<-1;
    return 0;
}
